<template>
	<!-- 首页灵活用工详情页组件 -->
	<view class="main">


			<view style="margin-top: 150rpx;">
				<u-empty text="暂无报名记录" mode="list"></u-empty>
			</view>


	</view>
</template>

<script>
		import api from '../../../../api/routes.js'
	export default {


		data() {
			return {
				page: 1,
				limit: 5,
				status: "loadmore",
				lists: [],
				// 拿到的数据总条数
				total: 0,
				//判断是否发送请求的条件
				load: false,

				keyword: '',

				type:'热门',
				list: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],



			};
		},
		// onLoad() {
		// 	this.getList()
		// },
		// onReachBottom() {
		// 	if (this.status === "loadmore") {
		// 		this.loadmore();
		// 	}
		// },
		methods: {
			goDetil(id){
				uni.navigateTo({
					url: '/package/pages/searchJob/other/detils?id='+id+'&type=求职',
				});
			},
			search(val) {
				this.load = false;
				this.page = 1
				this.limit = 5
				this.status = 'loadmore'
				this.lists = []
				this.getList()
			},
			loadmore() {
				this.page++;
				this.getList();
			},
			async getList() {
				wx.showLoading()
				// 判断当前是否在请求，如果为true正在请求数据，就让他返回空，如果为false没在请求，就让它开始请求数据
				if (this.load) {
					return;
				}
				this.load = true;
				// 请求数据时，状态改为加载中状态
				this.status = "loading";
				const res = await this.$myRequest({
					url: api.lgInfoPageList,
					method: "POST",
					data: {
						page: this.page,
						limit: this.limit,
						"orderSort": this.type=='热门'?1:2, //排序方式:1-热门,2-附近
						"key": this.keyword, //搜索关键词,
						"wages": "", //薪资
						"settlement": "", // 结算方式
						"mbId": "", //用户ID, ~~~~传这个值时,代表查询我发布的 ,大多数都不传
						"infoType": "求职", //类型:招工  / 求职  (必传)
					},
				});
				console.log(res)
				this.load = false;
				if (res.data.code == 0) {
					// this.lists = res.data.page.list
					this.total = res.data.page.totalCount;
					this.lists = [...this.lists, ...res.data.page.list];
					this.ismore();
					setTimeout(() => {
						wx.hideLoading()
					}, 2000)
				} else {
					wx.showToast({
						title: '查询失败',
						icon: 'none'
					})
				}
				console.log(res.data.page.list)
			},
			ismore() {
				if (this.total === this.lists.length) {
					this.status = "nomore";
				} else {
					this.status = "loadmore";
				}
			},
			change(val){
				this.type = val
				this.search()
			},
			goFabu(){
				uni.navigateTo({
					url: '/package/pages/searchJob/other/addInfo',
				});
			},
			lgRegister() {
				console.log("林工登记！！！");
				uni.navigateTo({
					url: '/package/pages/components/lingGonRegister',
				});
			}
		},
	};
</script>

<!-- <style>
/* #ifndef H5 */
page {
  height: 100%;
  background-color: #f2f2f2;
}

/* #endif */
</style> -->

<style lang="scss" scoped>
	.main {
		background: #ffffff;
	}
	.search{
		background: white;
		padding-top: 10rpx;
		padding-bottom: 10rpx;
		padding-left: 10rpx;
	}
	.register {
		height: 180rpx;
		background: white;
		display: flex;
		justify-content: space-evenly;
		align-items: center;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		.item_three{
			width: 25%;
			height: 120rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #909399;
			font-size: 24rpx;
			flex-direction: column;
			image{
				// width: 128rpx;
				// height: 128rpx;
				border-radius: 10px;
				// height: 80rpx;
			}
		}

	}
	.hotWork{
		background: white;
		.title{
			font-family: Arial, Helvetica, sans-serif;
			margin-left: 3%;
			display: flex;
			color: #909399;
			justify-content: space-between;
			.tabs{
				margin-right: 30rpx;
				.line{
					width: 30rpx;
					height: 4px;
					background: #1684fd;
					// background: #000088;
					margin-left: 15rpx;
					border-radius: 0 0 10rpx 10rpx;
				}
			}
			.active{
				color: #333;
				font-weight: bold;
			}
			.left{
				display: flex;
			}
			.right{
				margin-right: 3%;
			}

		}
		.workItem{
			width: 94%;
			margin-left: 3%;
			height: 240rpx;
			border-radius: 6px;
			box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
			margin-top: 20rpx;
			.header{
				height:90rpx;
				.name{
					color: #333;
					font-size: 30rpx;
					font-weight: 500;
					font-family: Arial, Helvetica, sans-serif;
				}
				.money{
					color: orange;
					font-size: 28rpx;
					font-weight: 500;
					font-family: Arial, Helvetica, sans-serif;
				}
			}
			.center{
				height: 75rpx;
				border-bottom: 1px solid #E4E7ED;
				.time{
					color: #909399;
					font-size: 24rpx;
					font-family: Arial, Helvetica, sans-serif;
				}
				.tags{
					display: flex;
					.tagItem{
						background: #EBEEF5;
						font-size: 24rpx;
						margin-right: 15rpx;
						padding:4rpx 10rpx 4rpx 10rpx;
						border-radius: 2px;
						color: #909399;
					}

				}
			}

			.footer{
				height:75rpx;
				.address{
					color: #909399;
					font-size: 24rpx;
					font-family: Arial, Helvetica, sans-serif;
				}
				.add1{
					color: #C0C4CC;
					font-size: 24rpx;
					font-family: Arial, Helvetica, sans-serif;
				}
			}
			.header,.center,.footer{
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 96%;
				margin-left: 2%;
			}
		}
	}
</style>
